<template>
<transition name="fade">
  <div class="app-box">
    <h1>根组件</h1>
    <!-- 路由链接 -->
    <router-link to="/home">首页</router-link>
    <router-link to="/about">关于</router-link>
    <router-link to="/my">我的</router-link>
    <hr />
    <!-- 路由视图 -->
      <transition name="fade" mode="out-in">
    <router-view></router-view>
    </transition>
  </div>
</transition>
</template>
<script setup>
</script>
<style scoped>
.app-box{
  text-align: center;
  font-size: 20px;
}
.app-box a{
  padding: 20px;
  color: black;
  text-decoration: none;
  font-weight: bold;
}
.app-box a.router-link-active{
  color: aqua;
}
.fade-enter-active,
.fade-leave-active {
  transition: opacity 2s ease;   /* 5 秒淡入淡出 */
}
.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}
</style>